Sample Code - Creating an Application Object

The segments of sample code below show how to create an Application Object using the Visual Basic New keyword and the CreateObject function. Two segments are shown for the New keyword. The benefits of both New keyword models are faster execution compared to CreateObject and that you can create an Application Object without having to remember the "Crystal.CRPE.Application".

Modify the following sample code to fit your needs.

' Dim the object and then Set it.
' Using the New keyword with the Set statement is the recommended
' model since it allows for better error checking and debugging,
' as well as faster execution.
Dim app as CRPEAuto.Application
Set app = New Application

Or,

' Automatically creates a new instance of the object when it is first
' referenced in the code, so it doesn't have to be set.
Dim app as New CRPEAuto.Application
Dim crystlApplication as CRPEAuto.Application
Set crystlApplication = CreateObject("Crystal.CRPE.Application")


Seagate Software IMG Holdings, Inc.
http://www.seagatesoftware.com
Support services:
http://support.seagatesoftware.com